/** ###################################################################
**     Filename  : line_detection.c
**     Project   : ccd2
**     Processor : MCF52255CAF80
**     Version   : Driver 01.00
**     Compiler  : CodeWarrior MCF C Compiler
**     Arthor	 : Yumi Chan, Cindy Yu
**     Abstract  :
**         
**     Settings  :
**     Contents  :
**         No public methods
**
** ###################################################################*/


/* Include */
#include "support_common.h"
#include "line_detection.h"


/* Variables */
trackCondition* current_state;
trackCondition* future_state;


/* Private Methods */
void setCurrentState(trackCondition cond, trackCondition** ptr, trackCondition state[])
{
	short i;
	
	if (state[0] == 0)
	{
		state[0] = cond;
		return ;
	}
	
	if (*ptr < (state + ((NUM_OF_STATE-1) * sizeof(trackCondition))))
	{
		*ptr += sizeof(trackCondition);
		**ptr = cond;
		return ;
	}
	
	for (i=0; i < NUM_OF_STATE - 1; ++i)
	{
		state[i] = state[i+1];
	}
	state[NUM_OF_STATE-1] = cond;
	
	return ;
}
